import Vue from 'vue'
import Router from 'vue-router'

import Layout from '@/views/Layout'

Vue.use(Router)

export const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    children: [{
      path: '',
      component: () => import('@/views/Article'),
      name: 'Article',
      meta: {title:'教练通'}
    }]
  }, {
    path: '/article_content',
    component: Layout,
    redirect: '/article_content/index',
    children: [{
      path: 'index',
      component: () => import('@/views/Article/article_content'),
      name: 'Article_Content',
      meta: { hiddenTab: true }
    }]
  }, {
    path: '/userCenter',
    component: Layout,
    children: [{
      path: '',
      redirect: '/userCenter/index'
    }, {
      path: 'index',
      component: () => import('@/views/UserCenter/index'),
      name: 'UserCenterCoach',
      meta: {
        title: '个人中心'
      }
    }, {
      path: 'learner',
      component: () => import('@/views/UserCenter/learner'),
      name: 'UserCenterLearner',
      meta: {
        title: '个人中心'
      }
    }]
  }, {
    path: '/learner',
    component: Layout,
    redirect: '/learner/index',
    children: [{
      path: 'index',
      component: () => import('@/views/Learner/index'),
      meta: {
        title: '我的学员'
      }
    }]
  }, {
    path: '/login',
    component: Layout,
    redirect: '/login/index',
    children: [{
      path: 'index',
      component: () => import('@/views/Login/index'),
      name: 'Login',
      meta: {
        title: '教练登录',
        hiddenTab: true
      }
    }]
  },{
    path: '/learnLogin',
    component: Layout,
    redirect: '/learnLogin/index',
    children: [{
      path: 'index',
      component: () => import('@/views/Login/learnLogin'),
      name: 'LearnLogin',
      meta: {
        title: '学员登录',
        hiddenTab: true
      }
    }]
  },
  {
    path: '/register',
    component: Layout,
    redirect: '/register/index',
    children: [{
      path: 'index',
      component: () => import('@/views/Register/index'),
      name: 'Register',
      meta: {
        title: '学员注册',
        hiddenTab: true
      }
    }]

  },
  {
    path: '/forgetPwd',
    component: Layout,
    redirect: '/forgetPwd/index',
    children: [{
      path: 'index',
      component: () => import('@/views/Login/forgetPwd'),
      name: 'ForgetPwd',
      meta: {
        title: '忘记密码',
        hiddenTab: true
      }
    }]
  }, {
    path: '/myOrder',
    component: Layout,
    redirect: '/myOrder/index',
    children: [{
      path: 'index',
      component: () => import('@/views/MyOrder/index'),
      name: 'MyOrder',
      meta: {
        title: '我的订单',
        hiddenTab: true
      }
    }]
  }
]

export default new Router({
  // mode: 'history',
  routes
})
